package cn.edu.stu.syllabus.datas;

import android.support.annotation.ColorRes;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.edu.stu.syllabus.R;
import cn.edu.stu.syllabus.switcher.ThemeStyleSwitcher;

/**
 * Created by daidaijie on 2017/3/8.
 */

public class ThemeStyle {

    public int styleRec;
    public int colorPrimary;
    public int colorPrimaryLight;
    public String name;

    public ThemeStyle(String name, int colorPrimary, int colorPrimaryLight, int styleRec) {
        this.name = name;
        this.colorPrimary = colorPrimary;
        this.colorPrimaryLight = colorPrimaryLight;
        this.styleRec = styleRec;
    }

    public static class ThemeStylesHolder {
        public static List<ThemeStyle> sThemeStyles;
        public static Map<String, ThemeStyle> sThemeStylesMap;

        static {
            sThemeStyles = new ArrayList<>();
            sThemeStyles.add(new ThemeStyle("blue", R.color.colorPrimary_Blue, R.color.colorPrimaryLight_Blue, R.style.AppTheme));
            sThemeStyles.add(new ThemeStyle("lightBlue", R.color.colorPrimary_LightBlue, R.color.colorPrimaryLight_LightBlue, R.style.AppThemeLightBlue));
            sThemeStyles.add(new ThemeStyle("indigo", R.color.colorPrimary_Indigo, R.color.colorPrimaryLight_Indigo, R.style.AppThemeIndigo));
            sThemeStyles.add(new ThemeStyle("cyan", R.color.colorPrimary_Cyan, R.color.colorPrimaryLight_Cyan, R.style.AppThemeCyan));
            sThemeStyles.add(new ThemeStyle("teal", R.color.colorPrimary_Teal, R.color.colorPrimaryLight_Teal, R.style.AppThemeTeal));
            sThemeStyles.add(new ThemeStyle("red", R.color.colorPrimary_Red, R.color.colorPrimaryLight_Red, R.style.AppThemeRed));
            sThemeStyles.add(new ThemeStyle("pink", R.color.colorPrimary_Pink, R.color.colorPrimaryLight_Pink, R.style.AppThemePink));
            sThemeStyles.add(new ThemeStyle("purple", R.color.colorPrimary_Purple, R.color.colorPrimaryLight_Purple, R.style.AppThemePurple));
            sThemeStyles.add(new ThemeStyle("deepPurple", R.color.colorPrimary_DeepPurple, R.color.colorPrimaryLight_DeepPurple, R.style.AppThemeDeepPurple));
            sThemeStyles.add(new ThemeStyle("green", R.color.colorPrimary_Green, R.color.colorPrimaryLight_Green, R.style.AppThemeGreen));
            sThemeStyles.add(new ThemeStyle("lightGreen", R.color.colorPrimary_LightGreen, R.color.colorPrimaryLight_LightGreen, R.style.AppThemeLightGreen));
            sThemeStyles.add(new ThemeStyle("lime", R.color.colorPrimary_Lime, R.color.colorPrimaryLight_Lime, R.style.AppThemeLime));
            sThemeStyles.add(new ThemeStyle("classic", R.color.colorPrimary_Classic, R.color.colorPrimaryLight_Classic, R.style.AppThemeClassic));
            sThemeStyles.add(new ThemeStyle("bili", R.color.colorPrimary_Bili, R.color.colorPrimaryLight_Bili, R.style.AppThemeBili));
            sThemeStyles.add(new ThemeStyle("orange", R.color.colorPrimary_Orange, R.color.colorPrimaryLight_Orange, R.style.AppThemeOrange));
            sThemeStyles.add(new ThemeStyle("deepOrange", R.color.colorPrimary_DeepOrange, R.color.colorPrimaryLight_DeepOrange, R.style.AppThemeDeepOrange));
            sThemeStyles.add(new ThemeStyle("brown", R.color.colorPrimary_Brown, R.color.colorPrimaryLight_Brown, R.style.AppThemeBrown));
            sThemeStyles.add(new ThemeStyle("grey", R.color.colorPrimary_Grey, R.color.colorPrimaryLight_Grey, R.style.AppThemeGrey));
            sThemeStyles.add(new ThemeStyle("blueGrey", R.color.colorPrimary_BlueGrey, R.color.colorPrimaryLight_BlueGrey, R.style.AppThemeBlueGrey));
            sThemeStyles.add(new ThemeStyle("black", R.color.colorPrimary_Black, R.color.colorPrimaryLight_Black, R.style.AppThemeBlack));

            sThemeStylesMap = new HashMap<>();
            for (ThemeStyle themeStyle : sThemeStyles) {
                sThemeStylesMap.put(themeStyle.name, themeStyle);
            }
        }
    }

    @ColorRes
    public static int getCurrentColorPrimaryLight() {
        return ThemeStyleSwitcher.getInstance().getCurrentThemeStyle().colorPrimaryLight;
    }

    public static int getCurrentColorPrimary() {
        return ThemeStyleSwitcher.getInstance().getCurrentThemeStyle().colorPrimary;
    }
}
